<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="mapui"></div>
    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>

    <script>
        
        var amap = null;

        map.Factory.create('mapui', {
            style: style,
            center: center, 
            zoom: 11,
            strategy: ['mapboxgl', 'openlayers', 'leaflet'],
            fullExtent: {
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            }
        }, (o) => {
            amap = o;

            var popupManage = map.Factory.PopupManage();
            let coun = 0;
            popup1 = popupManage.addTextPopup('2222222', [110.32343, 19.99401], '我是一个信息窗体',
                {
                    closeButton: true,
                    closeOnClick: false,
                    anchor: 'bottom',
                    maxWidth: '240px',
                    closeEvent: function () { alert('close' + coun) }
                });

            let dom = document.createElement("div");
            dom.innerHTML = "我替换了";

            setTimeout(() => {
                coun++
                popup1.updateContentByDom(dom);
            }, 3000);


            let text = "我替换了Text";

            setTimeout(() => {
                coun++
                popup1.updateContentByText(text);
            }, 6000);

            let html = "<a>我替换了Html</a>";

            setTimeout(() => {
                coun++
                popup1.updateContentByHtml(html);
            }, 9000);
        });
    </script>
</body>

</html>